<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script src="./md5.js"></script>
<script>

//编码对英文和数字没有效果，目的让cookie安全，没有实际意义

//编码escape()  ；解码unescape()
var str = 'hello 今天吃了好大一个西瓜'

var newStr = escape(str)

console.log('编码',newStr);

console.log('解码',unescape(newStr));


//对url地址进行编码;
//编码encodeURI() ；解码decodeURL()
var urlStr = 'http://www.baidu.com/';
console.log('编码',encodeURI(urlStr));
console.log('解码',decodeURI(encodeURI(urlStr)));

//encodeURIComponent编码
//decodeURIComponent解码
console.log('encodeURIComponent编码',encodeURIComponent(str));
console.log('decodeURIComponent解码',decodeURIComponent('hello%20%E4%BB%8A%E5%A4%A9%E5%90%83%E4%BA%86%E5%A5%BD%E5%A4%A7%E4%B8%80%E4%B8%AA%E8%A5%BF%E7%93%9C'));


//md5加密 单项加密不可逆 主要是出于安全考虑,在数据库里面密码是无用的,校验用户的密码是否正确的时候,拿到用户输入的密码进行加密.再和数据库里面加密的密码进行比较

var str2 = 'admin12345';
console.log('加密，字符数字，字母',rstr2hex(str));
</script>